package com.goldenautumn.prefabricate.widget.dialog

import android.content.Context
import android.view.ViewGroup
import com.chad.library.adapter4.BaseQuickAdapter
import com.chad.library.adapter4.viewholder.DataBindingHolder
import com.goldenautumn.prefabricate.R
import com.goldenautumn.prefabricate.databinding.ItemCountryBinding

class CountryAdapter : BaseQuickAdapter<String, DataBindingHolder<ItemCountryBinding>>() {

    var selectPosition = -1

    override fun onBindViewHolder(holder: DataBindingHolder<ItemCountryBinding>, position: Int, item: String?) {
        if(item == null) return
        val mBinding  = holder.binding

        mBinding.isCheck.setImageResource(if(selectPosition == position) R.mipmap.ic_address_select else R.mipmap.ic_address_not_select)

    }

    override fun onCreateViewHolder(context: Context, parent: ViewGroup, viewType: Int): DataBindingHolder<ItemCountryBinding> {
        return DataBindingHolder(R.layout.item_country,parent)
    }


}